package SwitchTest;

import java.util.Scanner;

/*
switch语句是选择语句，也可以叫分支语句
语法格式
switch(值){
    case 值1:
        java语句
        break;
    case 值2:
        java语句
        break;
    default:
        java语句;
}
如果分支没有break，将会出现穿透现象每条语句都执行
 */
public class SwitchTest1 {
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        System.out.println("请输入1-7");
        int day = s.nextInt();
        String str = "";
        switch(day){
            case 1:
                str = "星期一";
                break;
            case 2:
                str = "星期二";
                break;
            case 3:
                str = "星期三";
                break;
            case 4:
                str = "星期四";
                break;
            case 5:
                str = "星期五";
                break;
            case 6:
                str = "星期六";
                break;
            case 7:
                str = "星期天";
                break;
            default:
                str = "输入的数字不合法";
        }
        System.out.println(str);
    }
}
